<?php

class Nuo_Storage
{

	/**
	 * Store storages engine
	 * @static
	 * @access  private
	 * @var     array
	 */
	static private $_storages = array();

	/**
	 * Get instance of storage service
	 * @param  string $id
	 * @return Storage_Storage_Abstract
	 */
	static public function instance($id = 0)
	{
		if (!isset(self::$_storages[$id]))
		{
			$config = Nuo::getApi('core/storage') -> getConfig($id);

			$cls = $config['adapter'];

			self::$_storages[$id] = new $cls($config);
		}

		return self::$_storages[$id];
	}

}
